package kr.hkit.powerjava.chapter10;

import javax.swing.JOptionPane;

public class ArrayTest {
	public static void main(String[] args) {
		final int STUDENT = 5;
		int total = 0;
		
		int[] arrScores = new int[STUDENT];
		System.out.println("arrScores의 길이 "+arrScores.length);
		
		for(int i = 0; i < arrScores.length; i++) {
//			arrScores[i] = Integer.parseInt(JOptionPane.showInputDialog("점수를 입력하시오."));
			arrScores[i] = i+1;
		}
		
//		prnArray(arrScores);
//		arrSum(arrScores);
//		
//		arrScores[STUDENT] = 10;
		
		int[] arr = { 1,2,3,4,5,6,7,8,9};
		System.out.println(arr.length);
		
		for(int i : arr){
			System.out.printf("%3d", i);
		}
	}

	private static void arrSum(int[] arrScores) {
		int sum = 0;
		for(int i = 0; i<arrScores.length; i++) {
			sum = sum + arrScores[i];
		}
		System.out.println("배열 arrScores의 요소들의 합은 "+sum);
	}

	private static void prnArray(int[] arrScores) {
		for(int i = 0; i<arrScores.length; i++) {
			
			System.out.println("arrScores[" +i+ "] : " + arrScores[i]+ "\t");
		}
		System.out.println();
		
	}
}
